<%@page contentType="text/html; charset=utf-8" %>
<%@page import="eduboat.comm.util.ReturnConstant"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
<%-- 
/**
 * 创建信息
 * ============= jsp名: /work/admin/xtgl/role/role_edit.jsp
 * 作用描述:  修改角色
 * 创建人：fyr
 * 创建时间： 2013-1-18 
 * 修改信息1=============
 * 修改类型: //1.修改bug 2.业务变化修改 修改描述: 修改人： 修改时间：
 */
 --%>
		<title>智慧校园-后台管理系统</title>
		<%@ include file="/comm/jsp/public.jsp"%>
		<!--通用css-->
		<link rel="stylesheet" type="text/css" media="all" href="<%=path %>/work/comm/css/common.css" />
		<!--校验CSS  -->
		<link rel="stylesheet" type="text/css" media="all" href="<%=path %>/comm/plug/validateform/validationEngine.jquery.css" />
		<!-- 表单验证 -->
		<link   href="<%=path%>/comm/plug/validateform/validationEngine.jquery.css" rel="stylesheet" type="text/css" media="all"/>
		<script src="<%=path%>/comm/plug/validateform/jquery.validationEngine-zh_CN.js" type="text/javascript" charset="utf-8"></script>
		<script src="<%=path%>/comm/plug/validateform/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
		<!--通用js-->
        <script type="text/javascript" src="<%=path %>/work/comm/js/public.js"></script>
		<style>
body {
	background-image: url('');
	min-width: 100px;
}
</style>
		<script type="text/javascript"> 
		var role_code = art.dialog.data("role_code");   //获得角色编码

		$(document).ready(function(){
			if(role_code!=null){
				$("#role_code").val(role_code);
				initEditData(role_code);	//初始即将修改的角色信息			
			}
			/*
			 * form表单验证，submit提交时调用 type必须为submit
			 */
			jQuery("#myform").validationEngine({
				ajaxFormValidation: true,
				ajaxFormValidationMethod: 'post',
				ajaxFormValidationURL:"<%=path%>/work/admin/xtgl/json/roleCheckAction_checkFormEdit.action",
				onAjaxFormComplete: ajaxValidationCallback
			});		
		});

		/*
		 * form表单校验的回调函数
		 */
	     function ajaxValidationCallback(status, form, json, options){
			if(status === false)
		     return ;
		     editRole(form);
		 }

	     /*
		  * 修改角色函数
		  */
		 function editRole(form){
			 var data = {
						"role.role_code":$("#role_code").val().trim(),
	                	"role.role_name":$("#role_name").val().trim()
	                };
			 ajaxOtherCall({
				 url : "<%=path%>/work/admin/xtgl/json/roleEditAction_editRole.action", //访问页面 
				 data :data,
		         _beforeSendText:"正在修改数据，请稍等...",
		         _loginInti:false,
		         _successCall:function(data){
		         		
		            	art.dialog.alert("修改成功",function(){
		            			art.dialog.data("isUpdate",true);   //用来判断当前窗口是否有修改过得动作，以此决定关闭窗口时主界面是否刷新
			            	},"succeed");	
		         }
			});	
		 }//editRole  END

		 /*
		  * 初始化修改角色的信息
		  */
		function initEditData(role_code){
			$("#role_code").attr("readonly","readonly");
			ajaxOtherCall({
				 url : "<%=path%>/work/admin/xtgl/json/roleInitAction_initEdit.action", //访问页面 
				 data :{
			        	"role.role_code":role_code
			        },
		        _beforeSendText:"正在加载数据，请稍等...",
		        _loginInti:false,
		        _callBackOK:function(data){
		        		var role = data.role;
		            	$("#role_code").val(role.role_code);
		            	$("#role_name").val(role.role_name);
		            	$("#rolecode").text(role.role_code);
		        }
			});	
		 }//initEditData  END
</script>
	</head>
	<body style="margin-top: 20px">
	<!--学校信息-->
	<form id="myform">
		<input type="hidden" class="inp" name="role.role_type" id="role_type" value=""/>
		<div class="bz_div" style="width:450px; margin-top:10px"> 
			<div class="bz_tit">
				<div style="margin-left:10px;" >角色编辑信息</div>
   		 	</div>
		 	<div class="bz_cont">
		 	 	<table class="datadesr" style="width:400px;  margin-top:5px; margin-bottom:10px">
				<tr id="insert">
					<th style="width:100px; text-align:right" >角色编码：<span class="red">*</span></th>
					<td style="width:250px;"><span id="rolecode"></span>
					<input type="hidden" class="inp" name="role.role_code" id="role_code" value=""/>
					</td>
				</tr>
				<tr>
					<th style="width:100px; text-align:right">角色名称：<span class="red">*</span></th>
					<td style="width:250px;">
					<input class="validate[required,maxSize[100]] inp" name="role.role_name" id="role_name" value=""/>
					</td>
				</tr>
				</table>	
		 	</div><!-- .bz_cont end-->
	</div><!-- .bz_div end-->
	<!--初始化信息 end-->
	<input type="submit" class="regbutton3" value="保存" id="btnSave"  style="margin-left:150px" />
	</form>
	</body>
</html>
